/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bean.session;

import entity.PriceListEntity;
import javax.ejb.Stateless;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author wei
 */
@Stateless
public class PriceListEntityFacade extends AbstractFacade<PriceListEntity> {
    @PersistenceContext(unitName = "MacTeam-warPU")
    private EntityManager em;

    protected EntityManager getEntityManager() {
        return em;
    }

    public PriceListEntityFacade() {
        super(PriceListEntity.class);
    }
    
    public DataModel getAllPriceList() {
        Query query = em.createQuery("SELECT p FROM PriceList p WHERE p.archived!= 'true'");
        return new ListDataModel(query.getResultList());
    }
    
}
